<?php
namespace app\api\model;
use think\Model;

// 联系人信息表

class Staff extends Model
{
    protected $hidden = ['contact', 'position'];
    protected $autoWriteTimestamp = true;
    protected $updateTime = false;

    // 关联职位
    public function fposition() {
        return $this->hasOne('\app\api\model\Position','id','position')->bind(['post' => 'name', 'postId' => 'id']);
    }

    // 关联联系信息
    public function fcontact() {
        return $this->hasOne('\app\api\model\Contact','id','contact')->bind(
            ['mobile', 'qq', 'email', 'contactId' => 'id']
        );
    }
}

